<?php echo $header; ?>
<?php if ($error_warning) { ?>
<div class="warning"><?php echo $error_warning; ?></div>
<?php } ?>
<?php echo $column_left; ?><?php echo $column_right; ?>
<div id="content"><?php echo $content_top; ?>
  <div class="breadcrumb">
    <?php foreach ($breadcrumbs as $breadcrumb) { ?>
    <?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
    <?php } ?>
  </div>
  <h1><?php echo $heading_title; ?></h1>
  <p><?php echo $text_account_already; ?></p>
  <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data">
    <div class="content">
        <table class="form register">

            <tr>
                <td><span class="required">*</span> <?php echo $entry_email; ?></td>
                <td><input type="text" name="email" value="<?php echo $email; ?>" placeholder="请务必准确填写邮件地址以便于接收重要信息。" />
                    <?php if ($error_email) { ?>
                    <span class="error"><?php echo $error_email; ?></span>
                    <?php } ?></td>
            </tr>
            <tr>
                <td><span class="required">*</span> <?php echo $entry_password; ?></td>
                <td><input type="password" name="password" value="<?php echo $password; ?>" />
                    <?php if ($error_password) { ?>
                    <span class="error"><?php echo $error_password; ?></span>
                    <?php } ?></td>
            </tr>

        <tr>
          <td><span class="required">*</span> <?php echo $entry_telephone; ?></td>
          <td><input type="text" name="telephone" value="<?php echo $telephone; ?>" placeholder="请确保手机号码长期有效,以便接收系统重要通知。"  />&nbsp;&nbsp;<input id="gettelephone_code"  type="button" value="发送验证码" class="button"/>
            <?php if ($error_telephone) { ?>
            <span class="error"><?php echo $error_telephone; ?></span>
            <?php } ?></td>
        </tr>
          <tr>
          <td><span class="required">*</span> 验证码</td>
          <td><input type="text" name="telephone_code" value="<?php echo $telephone_code; ?>" />
            <?php if ($error_random_code) { ?>
            <span class="error"><?php echo $error_random_code; ?></span>
            <?php } ?></td>
        </tr>

            <tr>
                <td></td>
                <td>
                    <a class="btn-show-more" href="#">完整填写个人和公司信息可获得更多优惠!</a>
                </td>
            </tr>
            <tr class="company">
                <td><?php echo $entry_lastname; ?></td>
                <td><input type="text" name="lastname" value="<?php echo $lastname; ?>" /></td>
            </tr>
            <tr class="company">
                <td><?php echo $entry_firstname; ?></td>
                <td><input type="text" name="firstname" value="<?php echo $firstname; ?>" /></td>
            </tr>

            <tr class="company">
                <td>公司名称</td>
                <td><input type="text" name="company" value="<?php echo $company; ?>" /></td>
            </tr>
            <tr class="company">
                <td>公司地址</td>
                <td><input type="text" name="address_1" value="<?php echo $address_1; ?>" /></td>
            </tr>
            <tr class="company">
                <td>公司电话</td>
                <td><input type="text" name="company_phone" value="<?php echo $company_phone; ?>" /></td>
            </tr>
            <tr class="company">
                <td>公司行业</td>
                <td>
                    <select name="industry_category">
                        <option value="">请选择</option>
                        <option value="internet">互联网</option>
                        <option value="telecom">电信</option>
                        <option value="communication">通信与软件</option>
                        <option value="finance">金融</option>
                        <option value="governmental">政府机构</option>
                        <option value="realty">房地产</option>
                        <option value="traffic">交通</option>
                        <option value="energy">能源</option>
                        <option value="education">教育</option>
                        <option value="healthcare">医疗</option>
                        <option value="media">媒体</option>
                        <option value="manufacturing">传统制造业</option>
                        <option value="wholesale">批发和零售</option>
                        <option value="others">其他</option>
                    </select>
                </td>
            </tr>
            <tr class="company">
                <td>公司规模</td>
                <td>
                    <select name="company_size">
                        <option value="">请选择</option>
                        <option value="10"><10人</option>
                        <option value="50">10-50人</option>
                        <option value="100">50-100人</option>
                        <option value="500">100-500人</option>
                        <option value="1000">500-1000人</option>
                        <option value="more">>1000人</option>
                    </select>
                </td>
            </tr>
            <tr class="company">
                <td>您在公司的角色</td>
                <td>
                    <select name="company_role">
                        <option value="">请选择</option>
                        <option value="ceo">总裁或CEO级别</option>
                        <option value="cio">CIO或IT管理人员</option>
                        <option value="development">开发和测试工程师</option>
                        <option value="operation">运维工程师</option>
                        <option value="others">其他</option>
                    </select>
                </td>
            </tr>
            <tr class="company">
                <td>了解途径</td>
                <td>
                  <select name="channel">
                      <option value="">请选择</option>
                      <option value="recommendation">朋友推荐</option>
                      <option value="exhibition">行业展会</option>
                      <option value="medium report">媒体报道</option>
                      <option value="dev bbs">开发者社区</option>
                      <option value="offical weixin">官方微信</option>
                      <option value="offical weibo">官方微博</option>
                  </select>
                </td>
            </tr>
            <tr class="company">
                <td colspan="2">
                    <br/>
                    我们将通过电话的方式与您取得联系，为您提供充值券
                </td>
            </tr>
      </table>

    </div>
    <?php if ($text_agree) { ?>
    <div class="buttons">
      <div class="right"><?php echo $text_agree; ?>
        <?php if ($agree) { ?>
        <input type="checkbox" name="agree" value="1" checked="checked" />
        <?php } else { ?>
        <input type="checkbox" name="agree" value="1" />
        <?php } ?>
        <input type="submit" value="<?php echo $button_continue; ?>" class="button" />
      </div>
    </div>
    <?php } else { ?>
    <div class="buttons">
      <div class="right">
        <input type="submit" value="<?php echo $button_continue; ?>" class="button" />
      </div>
    </div>
    <?php } ?>
  </form>
  <?php echo $content_bottom; ?></div>
<script type="text/javascript"><!--


var wait=60;//时间
function time(o,p) { //o为按钮的对象，p为可选，这里是60秒过后，提示文字的改变
    if (wait == 0) {
            o.removeAttr("disabled");
            o.val("发送验证码");//改变按钮中value的值
            p.html("");
            wait = 60;
        } else {
            o.attr("disabled", true);//倒计时过程中禁止点击按钮
            o.val(wait + "s");//改变按钮中value的值
            wait--;
            setTimeout(function() {
                time(o,p);//循环调用
            },
    1000)
    }
}
    $("#gettelephone_code").click(function(){
        if($('input[name=\'telephone\']').val()==''){
            alert ( "请输入手机号");
            return false;
        }
        $.ajax({
            url: 'index.php?route=account/register/sendsms',
            type: 'post',
            data: $('input[name=\'telephone\']'),
            dataType: 'json',
            success: function(json) {
                if (json['success']) {
                    $('#gettelephone_code').after('<span class="sms_message">已发送，1分钟后可重新获取</span>');
                    time($("#gettelephone_code"),$(".sms_message"));
                }else{
                    alert(json['error']);
                }
            }
        });

    });


$('input[name=\'customer_group_id\']:checked').live('change', function() {
	var customer_group = [];
	
<?php foreach ($customer_groups as $customer_group) { ?>
	customer_group[<?php echo $customer_group['customer_group_id']; ?>] = [];
	customer_group[<?php echo $customer_group['customer_group_id']; ?>]['company_id_display'] = '<?php echo $customer_group['company_id_display']; ?>';
	customer_group[<?php echo $customer_group['customer_group_id']; ?>]['company_id_required'] = '<?php echo $customer_group['company_id_required']; ?>';
	customer_group[<?php echo $customer_group['customer_group_id']; ?>]['tax_id_display'] = '<?php echo $customer_group['tax_id_display']; ?>';
	customer_group[<?php echo $customer_group['customer_group_id']; ?>]['tax_id_required'] = '<?php echo $customer_group['tax_id_required']; ?>';
<?php } ?>	

	if (customer_group[this.value]) {
		if (customer_group[this.value]['company_id_display'] == '1') {
			$('#company-id-display').show();
		} else {
			$('#company-id-display').hide();
		}

		if (customer_group[this.value]['company_id_required'] == '1') {
			$('#company-id-required').show();
		} else {
			$('#company-id-required').hide();
		}
		
		if (customer_group[this.value]['tax_id_display'] == '1') {
			$('#tax-id-display').show();
		} else {
			$('#tax-id-display').hide();
		}
		
		if (customer_group[this.value]['tax_id_required'] == '1') {
			$('#tax-id-required').show();
		} else {
			$('#tax-id-required').hide();
		}	
	}
});

$('input[name=\'customer_group_id\']:checked').trigger('change');
//--></script>

<!--
<script type="text/javascript"><!--
$('select[name=\'country_id\']').bind('change', function() {
	$.ajax({
		url: 'index.php?route=account/register/country&country_id=' + this.value,
		dataType: 'json',
		beforeSend: function() {
			$('select[name=\'country_id\']').after('<span class="wait">&nbsp;<img src="catalog/view/theme/default/image/loading.gif" alt="" /></span>');
		},
		complete: function() {
			$('.wait').remove();
		},
		success: function(json) {
			if (json['postcode_required'] == '1') {
				$('#postcode-required').show();
			} else {
				$('#postcode-required').hide();
			}

			html = '<option value=""><?php echo $text_select; ?></option>';

			if (json['zone'] != '') {
				for (i = 0; i < json['zone'].length; i++) {
        			html += '<option value="' + json['zone'][i]['zone_id'] + '"';

					if (json['zone'][i]['zone_id'] == '<?php echo $zone_id; ?>') {
	      				html += ' selected="selected"';
	    			}

	    			html += '>' + json['zone'][i]['name'] + '</option>';
				}
			} else {
				html += '<option value="0" selected="selected"><?php echo $text_none; ?></option>';
			}

			$('select[name=\'zone_id\']').html(html);
		},
		error: function(xhr, ajaxOptions, thrownError) {
			alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
		}
	});
});

$('select[name=\'country_id\']').trigger('change');
</script>-->


<script type="text/javascript"><!--
$(document).ready(function() {
    $('.btn-show-more').toggle(function(){
            $('table.register .company').show();
        },function() {
            $('table.register .company').hide();
        });
        return false;
    });
	$('.colorbox').colorbox({
		width: 640,
		height: 480
});
//--></script> 
<?php echo $footer; ?>